package com.toutoushidao.ssm.entity;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.toutoushidao.ssm.util.CustomDateSerializer;

import java.beans.Transient;
import java.io.Serializable;
import java.util.Date;


/**
 * 用户
 * @author laodun
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class User implements Serializable{
    private Long id;
	private String name;
    private String password;
    private String avatar;
    private Integer sex;
    private UserData udata;

    private String phone;
    private Integer status;
    @JsonSerialize(using = CustomDateSerializer.class)
    private Date createTime;
    private Integer flag = -1;//非DB字段，用于标记登录用户和查看用户之间的关系

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Transient
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }


    public UserData getUdata() {
        return udata;
    }

    public void setUdata(UserData udata) {
        this.udata = udata;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }




    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }



    public Integer getFlag() {
        return flag;
    }

    public void setFlag(Integer flag) {
        this.flag = flag;
    }




    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", avatar='" + avatar + '\'' +
                ", sex=" + sex +
                ", udata=" + udata +
                ", phone='" + phone + '\'' +
                ", status=" + status +
                ", createTime=" + createTime +
                ", flag=" + flag +
                '}';
    }
}
